//
//  Ba.swift
//  Encrypto VPN
//
//  Created by 周波 on 2024/7/15.
//

import SwiftUI

struct Ba: View {
    var title: String
    var onBackTap: () -> Void
    
    var body: some View {
        
        VStack (spacing:0){
            
            ZStack {
                Rectangle()
                    .frame(height: UIApplication.statusBarHeight)
                    .foregroundColor(Color( "mainback"))
                    .edgesIgnoringSafeArea(.all)
                HStack{
                    
                    Image("back")
                        .resizable()
                        .aspectRatio(contentMode: .fill)
                        .frame(width: 24, height: 25)
                        .onTapGesture {
                            
                            // adManager.showInterstitial()
                            
                            self.onBackTap() // 点击时调用闭包
                        }
                        .padding(.leading,20)
                    
                    Spacer()
                    Text(title)
                        .font(.title)
                        .foregroundColor(Color.white)
                        .bold()
                    Spacer()
                    
                }.frame(height: 44)
                
            }
            
            
            
        }
        
    }
}

#Preview {
    Ba(title: "我爱心心",
       onBackTap: {
      
  })
}
